home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_309 / sksh / hints.doc < prev    next >
Text File  |  1992-05-06  |  7KB  |  331 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.                                  Hints and Tips for
  17.  
  18.                                         SKsh
  19.  
  20.                            A ksh-like Shell for the Amiga
  21.  
  22.                                      Version 1.3
  23.  
  24.  
  25.                                (Copyright) 1989, 1990
  26.  
  27.                                      Steve Koren
  28.  
  29.                                    January 2, 1990
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.           Making SKsh Resident
  74.  
  75.             SKsh version 1.1 or later can be made  resident.   Add  a  line
  76.             like this to your startup-sequence:
  77.  
  78.                c:resident sksh
  79.  
  80.             where 'sksh' is the path to the  sksh  command  itself.   Then,
  81.             when SKsh is run through  a  shell-window,  the  resident  SKsh
  82.             will be used, not the disk-based SKsh.
  83.  
  84.  
  85.           Starting SKsh with 'newcli' or 'newshell'
  86.  
  87.             The  'newcli'  or  'newshell'   commands   can   be   made   to
  88.             automatically start SKsh when a new CLI  window  is  generated.
  89.             There are two things that need to be  done  for  this.   First,
  90.             define an alias like this:
  91.  
  92.              alias newcli='$(which newshell) CON:0/0/640/200/SKsh_Window'
  93.  
  94.             Also, you must create a s:Shell-Startup file which  runs  SKsh.
  95.             Mine looks like this:
  96.  
  97.                Prompt "%N.%S> "
  98.                sys:bin/setfont source 10 window
  99.                stack 16000
  100.                sksh
  101.  
  102.             You may have to change this if you do not  have  the  'setfont'
  103.             command  or  do  not  have  it  installed  in  'sys:bin'.   The
  104.             'newcli' command will now start  up  a  new  window,  with  the
  105.             given size, and  run  SKsh  for  you  automatically  using  the
  106.             resident 'SKsh'.  To make the 'exit' command  in  SKsh  destroy
  107.             the window when SKsh exits, put the following in  your  .skshrc
  108.             file:
  109.  
  110.                LOGOUT='endcli'
  111.  
  112.             Now, the 'newcli' alias can be used transparently with SKsh.
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.           SKSH Amiga Shell             Page 2               Hints and Tips
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.           Setting up a man-page Directory
  141.  
  142.             To set up a  man-page  directory,  create  one  in  a  suitable
  143.             place, and assign the MAN:  device  to  point  to  it  in  your
  144.             startup-sequence, like this:
  145.  
  146.                assign MAN: sys:usr/man
  147.  
  148.             The following function can be used to show man-pages:
  149.  
  150.                function man {
  151.                   if [ ! -f "MAN:$1.MAN" ]
  152.                   then
  153.                      echo "No manual entry for $1"
  154.                   else
  155.                      more "MAN:$1.MAN"
  156.                   fi
  157.                }
  158.  
  159.             (You can also remove the function begin and end lines  and  use
  160.             it as a script with the  's'  bit  set).   Many  public  domain
  161.             programs come with a "README" or .DOC file which  explains  how
  162.             to use the program.  Copy these into  the  MAN:  directory  and
  163.             rename them to prog.MAN.  Then, you can use:
  164.  
  165.                man prog
  166.  
  167.             to display the documentation file.  This is a  simple  example,
  168.             but  it  could  be  extended  to,   for   example,   uncompress
  169.             compressed files before viewing for  prog.MAN  and  prog.MAN.Z.
  170.             You could also extend it to use a pager  defined  by  a  $PAGER
  171.             variable.  Just replace 'more' with $PAGER.
  172.  
  173.  
  174.           Forcing execution as a program
  175.  
  176.             The 'force' keyword will only force  execution  as  a  builtin,
  177.             alias,  or  function.   To  force  execution  as  an   external
  178.             program, simply use:
  179.  
  180.                $(which prog) args
  181.  
  182.  
  183.            
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.           SKSH Amiga Shell             Page 3               Hints and Tips
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.           Re-sourcing the .skshinit file
  207.  
  208.             If you source the .skshinit file  after  you  start  SKsh,  any
  209.             options you have set in your .skshrc file will  potentially  be
  210.             overridden.  One example  of  this  is  the  'e'  option.   The
  211.             .skshinit file sets it, which disables  command  line  editing.
  212.             It is reset in the .skshrc file.  If you source  the  .skshinit
  213.             file again without sourcing the .skshrc file, you will have  to
  214.             reset this option flag manually.
  215.  
  216.  
  217.           Using ^r for reverse searches
  218.  
  219.             The SKsh usage of ^r for reverse  searches  is  different  than
  220.             the ksh usage.  In ksh, you type ^r, which is echoed, the  text
  221.             you wish to search for, and then return.   In  SKsh,  you  type
  222.             the text you wish to search for, followed by ^r.  I have  found
  223.             this usage more convienent.
  224.  
  225.  
  226.           Changing default command options
  227.  
  228.             To  change  the  default  command  options  for  a   particular
  229.             command, define an alias  of  the  same  name  which  uses  the
  230.             'force' keyword.  For example, to change the  'cp'  command  so
  231.             that it uses the 'clone' option and echoes file names  as  they
  232.             are copied, put the following alias in your .skshrc file:
  233.  
  234.               alias cp = 'force -b cp -cv'
  235.  
  236.  
  237.           File name completion hints
  238.  
  239.             If there is but one file in a directory,  using  <esc><esc>  or
  240.             <tab> will insert the file name even if no prefix of  the  file
  241.             name is typed.
  242.  
  243.             The <esc>= command can be used to list  all  file  names  in  a
  244.             given directory.  If the previous word ends in a slash,  <esc>=
  245.             will list each file in the directory:
  246.  
  247.               [dh0:]: more ram:test/
  248.             (press <esc>=)
  249.               1) ram:test/file1.txt
  250.               2) ram:test/file2.txt
  251.               3) ram:test/my_file.txt
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.           SKSH Amiga Shell             Page 4               Hints and Tips
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.           Maximum command line length
  272.  
  273.             Command lines  which  are  passed  to  external  functions  are
  274.             limited  in  length  by  AmigaDos  to  255  characters.   Alias
  275.             substitions are limited in length by SKsh to  1023  characters;
  276.             lines longer than that will generate a syntax error.   However,
  277.             SKsh  builtins  can  operate  on  any  number   of   arguments.
  278.             Therefore, a "dir foo:*" might generate a  syntax  error  if  a
  279.             very large number of files are matched.  In these cases  (which
  280.             should be rare) the builtin form of the alias  (in  this  case,
  281.             "ls")  will  operate  correctly  since  there  are  no   length
  282.             limitations.
  283.  
  284.  
  285.           Bypassing Internal Commands
  286.  
  287.             If a name is interpreted  by  SKsh  as  a  builtin,  alias,  or
  288.             function, but is also an external command,  starting  the  name
  289.             with a capital letter will  force  SKsh  to  use  the  external
  290.             command.  SKsh internal  commands  are  case  sensitive,  while
  291.             external binaries are not.  For example,  using  a  lower  case
  292.             "dir" normally invokes the SKsh alias of that  name.   However,
  293.             using "Dir" will invoke the AmigaDos command provided  that  it
  294.             is in your search path.
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.           SKSH Amiga Shell             Page 5               Hints and Tips
  328.  
  329.  
  330.  
  331.